package LeetCode.leetcode27;

public class Review3 {
    public static void main(String[] args) {
        new Review3().removeElement(new int[]{3,2,2,3},3);
    }
    public int removeElement(int[] nums, int val) {
        int l = -1;
        int r = 0;
        while (r < nums.length){
            if (nums[r] == val){
                r++;
            }else {
                nums[++l] = nums[r++];
            }
        }
        return l+1;
    }
}
